<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script src="http://connect.facebook.net/zh_TW/all.js"></script>

<script type="text/javascript" src="../__cdn/facebook/facebox/facebox.js"></script>
<link href="../__cdn/facebook/facebox/facebox.css?x" media="screen" rel="stylesheet" type="text/css" />

<script type="text/javascript">
var fbloaded = false;
var isShowGame = false;

var appid = '125104644198239';
var p_user = <?php echo $p_user ?>;
var g_user = <?php echo json_encode($g_user); ?>;
var f = <?php echo $friends ?>;

var system = <?php echo json_encode($system); ?>;

var game_url = '<?php echo $game_url ?>';
var img_url = '<?php echo $img_url ?>';

var is_register = '<?php echo $is_register ?>';
var is_firstin  = '<?php echo $is_firstin ?>';

var flashvars = {};
flashvars.is_register 		= is_register > 0 ? true : false;
flashvars.is_firstin 		= is_firstin > 0 ? true: false;

flashvars.appid		= '1';
flashvars.mnick 	= p_user.name;
flashvars.nick 		= p_user.nick;
flashvars.sex		= p_user.sex;

flashvars.avatar	= {};
flashvars.avatar.icon	= "http://graph.facebook.com/"	+ p_user.puid + "/picture";
flashvars.avatar.middle	= "http://graph.facebook.com/"	+ p_user.puid + "/picture?type=small";
flashvars.avatar.big	= "http://graph.facebook.com/"	+ p_user.puid + "/picture?type=normal";


<?php
foreach($fv as $k => $v) {
	echo "flashvars.$k = " . json_encode($v) . ";
";
}
?>

flashvars.urls.homepage = 'http://www.facebook.com/profile.php?id=' + p_user.puid;

function get_userdata() {
	return flashvars;
}

swfobject.embedSWF(
	'<?php echo $app_swf_path ?>',
	"flashcontent",
	"760",
	"610",
	"9.0.0",
	"expressInstall.swf",
	{},
	{
		"allowScriptAccess": "always",
		"allowFullScreen": "true",
		"wmode": "transparent"
	}
);
<?php include_once 'main.js'; ?>
</script>

<style type="text/css">
/*<?php include_once 'main.css'; ?>*/
</style>
</head><body>

<?php include_once 'main.html'; ?>

<div id="fb-root"></div>
<script type="text/javascript"><!--

function loadinit() {
	if(fbloaded) return false;
	fbloaded = true;
}

jQuery(document).ready(function(){
	goGame();

	// init
	FB.init({appId: appid, status: true, cookie: false, xfbml: false});
	setTimeout(function(){
	    FB.Canvas.setSize({"height":jQuery("body").height(),"width":760});
	    FB.Canvas.setAutoResize(10);
	},3000);
	FB.Canvas.setAutoResize(10);

	FB.getLoginStatus(function(response) {
		if(response.status != 'connected') {
			FB.Event.subscribe('auth.login', function(response) {
				loadinit();
			});
			FB.login(function(){}, {perms:'email,publish_stream'});
		}
		else {
			loadinit();
		}
	});
});
--></script>


<div style="position: absolute;top:-10000px;">
<form id="reload_form" action="" target="_self" method="post">
<?php foreach($_REQUEST as $n => $req) :?>
<input type="hidden" name="<?php echo $n ?>" value="<?php echo $req ?>" />
<?php endforeach; ?>
</form>
</div>
<div id="track-root" style="height: 1px; position: absolute;top:-10000px;"></div>

<?php if(ujn::getCFG(CFG_IS_ADMIN)) ___INCLUDE('main.admin.php'); ?>

</body>
</html>
